package com.newly.common.base.entity.auth;

import com.newly.common.base.entity.sys.tenant.po.TenantPo;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @program: newly-parent
 * @remark: 用户详情信息基类
 * @author: guan
 * @create: 2021-12-23 05:20
 */
@Data
public class TenantDetails implements Serializable {
    private static final long serialVersionUID = -1;
    /**
     * 用户id
     */
    protected Long userId;
    /**
     * 用户昵称
     */
    protected String nickname;
    /**
     * 用户名
     */
    protected String username;
    /**
     * 用户类型
     */
    protected int type;
    /**
     * 用户授权信息
     */
    protected List<AuthPayload> authPayloads;

    public TenantDetails(TenantPo tenantPo, List<AuthPayload> authPayloads) {
        this.userId = tenantPo.getId();
        this.username = tenantPo.getUsername();
        this.nickname = tenantPo.getNickname();
        this.type = tenantPo.getType();
        this.authPayloads = authPayloads;
    }

    public TenantDetails() {
    }

    public TenantDetails(ICurrentTenant currentTenant, List<AuthPayload> authPayloads) {
        this.userId = currentTenant.getUserId();
        this.username = currentTenant.getUsername();
        this.nickname = currentTenant.getNickname();
        this.type = currentTenant.getType();
        this.authPayloads = authPayloads;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }


}
